package com.jh.channel.pojo.fastsilver;

import javax.persistence.*;
import java.io.Serializable;
import java.text.ParseException;
import java.util.Date;
import java.util.Objects;

/**
 * 快银通道注册表
 * @author lichengying
 */
@Entity
@Table(name = "t_fastsilver_internal")
public class FastSilverInternal implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "id")
    private long id;

    //userid
    @Column(name = "user_id")
    private String userId;

    //商户进件单号
    @Column(name = "order_no")
    private String orderNo;

    //商户全称
    @Column(name = "shop_name")
    private String shopName;

    //商户简称
    @Column(name = "nickname")
    private String nickname;

    //负责人
    @Column(name = "merchant_name")
    private String merchantName;

    //负责人手机号
    @Column(name = "phone")
    private String phone;

    //商铺地址
    @Column(name = "shop_address")
    private String shopAddress;

    //客服电话
    @Column(name = "shop_phone")
    private String shopPhone;

    //邮箱
    @Column(name = "email")
    private String email;

    //省
    @Column(name = "province")
    private String province;

    //市
    @Column(name = "city")
    private String city;

    //区/县
    @Column(name = "area")
    private String area;

    //详细地址
    @Column(name = "address")
    private String address;

    //商户类型
    @Column(name = "business_type")
    private String businessType;

    //营业执照
    @Column(name = "licence_no")
    private String licenceNo;

    //证件起始时间
    @Column(name = "licence_begin_date")
    private String licenceBeginDate;

    //证件结束时间
    @Column(name = "licence_expire_date")
    private String licenceExpireDate;

    //法人姓名
    @Column(name = "artif_name")
    private String artifName;

    //法人手机号
    @Column(name = "artif_phone")
    private String artifPhone;

    //法人身份证号
    @Column(name = "id_card")
    private String idCard;

    //微信费率
    @Column(name = "rate_wx")
    private String rateWx;

    //支付宝费率
    @Column(name = "rate_alipay")
    private String rateAlipay;

    //结算人姓名
    @Column(name = "card_name")
    private String cardName;

    //结算卡号
    @Column(name = "card")
    private String card;

    //结算人手机号
    @Column(name = "card_phone")
    private String cardPhone;

    //结算银行
    @Column(name = "bank_name")
    private String bankName;

    //结算开户行
    @Column(name = "bank_address")
    private String bankAddress;

    //结算联行号
    @Column(name = "bank_add_no")
    private String bankAddNo;

    //结算人身份证号
    @Column(name = "bank_id_card")
    private String bankIdCard;

    //经营类型
    @Column(name = "type")
    private String type;

    //经营范围
    @Column(name = "classify")
    private String classify;

    //合作商号
    @Column(name = "agent_id")
    private String agentId;

    //注册状态
    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private LoginStatus status;

    @Column(name = "error_msg")
    private String errorMsg;

    //商户号
    @Column(name = "merchant_id")
    private String merchantId;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "update_time")
    private Date updateTime;

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getMerchantName() {
        return merchantName;
    }

    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getLicenceNo() {
        return licenceNo;
    }

    public void setLicenceNo(String licenceNo) {
        this.licenceNo = licenceNo;
    }

    public String getLicenceBeginDate() {
        return licenceBeginDate;
    }

    public void setLicenceBeginDate(String licenceBeginDate) {
        this.licenceBeginDate = licenceBeginDate;
    }

    public void setLicenceExpireDate(String licenceExpireDate) {
        this.licenceExpireDate = licenceExpireDate;
    }

    public String getArtifName() {
        return artifName;
    }

    public void setArtifName(String artifName) {
        this.artifName = artifName;
    }

    public String getArtifPhone() {
        return artifPhone;
    }

    public void setArtifPhone(String artifPhone) {
        this.artifPhone = artifPhone;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getRateWx() {
        return rateWx;
    }

    public void setRateWx(String rateWx) {
        this.rateWx = rateWx;
    }

    public String getRateAlipay() {
        return rateAlipay;
    }

    public void setRateAlipay(String rateAlipay) {
        this.rateAlipay = rateAlipay;
    }

    public String getCardName() {
        return cardName;
    }

    public void setCardName(String cardName) {
        this.cardName = cardName;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getCardPhone() {
        return cardPhone;
    }

    public void setCardPhone(String cardPhone) {
        this.cardPhone = cardPhone;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankAddress() {
        return bankAddress;
    }

    public void setBankAddress(String bankAddress) {
        this.bankAddress = bankAddress;
    }

    public String getBankAddNo() {
        return bankAddNo;
    }

    public void setBankAddNo(String bankAddNo) {
        this.bankAddNo = bankAddNo;
    }

    public String getBankIdCard() {
        return bankIdCard;
    }

    public void setBankIdCard(String bankIdCard) {
        this.bankIdCard = bankIdCard;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getClassify() {
        return classify;
    }

    public void setClassify(String classify) {
        this.classify = classify;
    }

    public String getAgentId() {
        return agentId;
    }

    public void setAgentId(String agentId) {
        this.agentId = agentId;
    }

    public LoginStatus getStatus() {
        return status;
    }

    public void setStatus(LoginStatus status) {
        this.status = status;
    }

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }

    public String getShopAddress() {
        return shopAddress;
    }

    public void setShopAddress(String shopAddress) {
        this.shopAddress = shopAddress;
    }

    public String getShopPhone() {
        return shopPhone;
    }

    public void setShopPhone(String shopPhone) {
        this.shopPhone = shopPhone;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getLicenceExpireDate() {
        return licenceExpireDate;
    }

    @Override
    public String toString() {
        return "FastSilverInternal{" +
                "id=" + id +
                ", userId='" + userId + '\'' +
                ", orderNo='" + orderNo + '\'' +
                ", shopName='" + shopName + '\'' +
                ", nickname='" + nickname + '\'' +
                ", merchantName='" + merchantName + '\'' +
                ", phone='" + phone + '\'' +
                ", shopAddress='" + shopAddress + '\'' +
                ", shopPhone='" + shopPhone + '\'' +
                ", email='" + email + '\'' +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", area='" + area + '\'' +
                ", address='" + address + '\'' +
                ", businessType='" + businessType + '\'' +
                ", licenceNo='" + licenceNo + '\'' +
                ", licenceBeginDate=" + licenceBeginDate +
                ", artifName='" + artifName + '\'' +
                ", artifPhone='" + artifPhone + '\'' +
                ", idCard='" + idCard + '\'' +
                ", rateWx='" + rateWx + '\'' +
                ", rateAlipay='" + rateAlipay + '\'' +
                ", cardName='" + cardName + '\'' +
                ", card='" + card + '\'' +
                ", cardPhone='" + cardPhone + '\'' +
                ", bankName='" + bankName + '\'' +
                ", bankAddress='" + bankAddress + '\'' +
                ", bankAddNo='" + bankAddNo + '\'' +
                ", bankIdCard='" + bankIdCard + '\'' +
                ", type='" + type + '\'' +
                ", classify='" + classify + '\'' +
                ", agentId='" + agentId + '\'' +
                ", status='" + status + '\'' +
                ", merchantId='" + merchantId + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FastSilverInternal internal = (FastSilverInternal) o;
        return id == internal.id &&
                Objects.equals(userId, internal.userId) &&
                Objects.equals(orderNo, internal.orderNo) &&
                Objects.equals(shopName, internal.shopName) &&
                Objects.equals(nickname, internal.nickname) &&
                Objects.equals(merchantName, internal.merchantName) &&
                Objects.equals(phone, internal.phone) &&
                Objects.equals(shopAddress, internal.shopAddress) &&
                Objects.equals(shopPhone, internal.shopPhone) &&
                Objects.equals(email, internal.email) &&
                Objects.equals(province, internal.province) &&
                Objects.equals(city, internal.city) &&
                Objects.equals(area, internal.area) &&
                Objects.equals(address, internal.address) &&
                Objects.equals(businessType, internal.businessType) &&
                Objects.equals(licenceNo, internal.licenceNo) &&
                Objects.equals(licenceBeginDate, internal.licenceBeginDate) &&
                Objects.equals(artifName, internal.artifName) &&
                Objects.equals(artifPhone, internal.artifPhone) &&
                Objects.equals(idCard, internal.idCard) &&
                Objects.equals(rateWx, internal.rateWx) &&
                Objects.equals(rateAlipay, internal.rateAlipay) &&
                Objects.equals(cardName, internal.cardName) &&
                Objects.equals(card, internal.card) &&
                Objects.equals(cardPhone, internal.cardPhone) &&
                Objects.equals(bankName, internal.bankName) &&
                Objects.equals(bankAddress, internal.bankAddress) &&
                Objects.equals(bankAddNo, internal.bankAddNo) &&
                Objects.equals(bankIdCard, internal.bankIdCard) &&
                Objects.equals(type, internal.type) &&
                Objects.equals(classify, internal.classify) &&
                Objects.equals(agentId, internal.agentId) &&
                Objects.equals(status, internal.status) &&
                Objects.equals(merchantId, internal.merchantId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, orderNo, shopName, nickname, merchantName, phone, shopAddress, shopPhone, email, province, city, area, address, businessType, licenceNo, licenceBeginDate, artifName, artifPhone, idCard, rateWx, rateAlipay, cardName, card, cardPhone, bankName, bankAddress, bankAddNo, bankIdCard, type, classify, agentId, status, merchantId);
    }

    public void transform(FastSilverInternalView internal) throws ParseException {
        setOrderNo(internal.getOrderNo());
        setAddress(internal.getAddress());
        setAgentId(internal.getAgentId());
        setArea(internal.getArea());
        setIdCard(internal.getIdCard());
        setArtifName(internal.getArtifName());
        setBankAddNo(internal.getBankAddNo());
        setBankAddress(internal.getBankAddress());
        setBankName(internal.getBankName());
        setBusinessType(internal.getBusinessType());
        setArtifPhone(internal.getArtifPhone());
        setCard(internal.getCard());
        setCardName(internal.getCardName());
        setCardPhone(internal.getCardPhone());
        setCity(internal.getCity());
        setClassify(internal.getClassify());
        setEmail(internal.getEmail());
        setLicenceBeginDate(internal.getLicenceBeginDate());
        setLicenceNo(internal.getLicenceNo());
        setBankIdCard(internal.getBankIdCard());
        setMerchantId(internal.getMerchantId());
        setMerchantName(internal.getMerchantName());
        setNickname(internal.getNickname());
        setPhone(internal.getPhone());
        setProvince(internal.getProvince());
        setRateAlipay(internal.getRateAlipay());
        setRateWx(internal.getRateWx());
        setShopName(internal.getShopName());
        setStatus(LoginStatus.PENDING);
        setType(internal.getType());
        setUserId(internal.getUserId());
        setLicenceExpireDate(internal.getLicenceExpireDate());
    }
}
